package com.malphi.framework.test;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;

@SuppressWarnings("serial")
public class MyServlet extends HttpServlet {
	@Autowired
	SpringTest springTest;
	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws IOException, ServletException {
		String clientName = springTest.get();
		PrintWriter out;
		String title = "HelloServlet";
		String heading1 = "HelloServlet的doGet方法的输出：";
		// set content type
		System.out.println("--111---"+clientName);
		response.setContentType("text/html;charset=GB2312");
		// write html page
		out = response.getWriter();
		out.print("<HTML><HEAD><TITLE>" + title + "</TITLE>");
		out.print("</HEAD><BODY>");
		out.print(heading1);
		out.println("<h1><p>" + clientName + ":您好</h1>");
		out.print("</BODY></HTML>");

		out.close();
	}
}
